﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WSManager.Model;
using FluentValidation;


namespace WSManager.ModelValidation
{
    public class WebValidator: AbstractValidator<Web>
    {
        WebValidator()
        {
            RuleFor(w => w.Name).NotNull().NotEmpty();
            RuleFor(w => w.Articles).NotNull().SetCollectionValidator(new ArticleValidator());
            RuleFor(w => w.Categories).NotNull().SetCollectionValidator(new CategoryValidator());
            RuleFor(w => w.Files).NotNull().SetCollectionValidator(new WebFileValidator());
            RuleFor(w => w.Images).NotNull().SetCollectionValidator(new WebImageValidator());
            RuleFor(w => w.Metadata).NotNull();
        }
    }
}
